let fs = require('fs');
let Mock = require('mockjs')

// 生成的字符串
// let data = Mock.mock({
//     "data|100" : ['@cword(50,100)']
// });

// 生成对象
let data = Mock.mock({
    "data|100" : [{
        img : '@image(100x100,@color)',
        name : '@cword(5,8)',
        price : /\d{2,4}/,
        count : /\d{2,4}/,
    }]
})

// 把数据写入到json中
fs.writeFileSync('./data.json' , JSON.stringify(data.data));
